package com.weipai.springboot.module.controller;

import com.weipai.springboot.model.Help;
import com.weipai.springboot.model.HelpCate;
import com.weipai.springboot.model.api.Response;
import com.weipai.springboot.module.service.HelpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 曹朋飞
 * @Date: 2019/01/10 16:31
 * 
 * 帮助中心控制类
 */
@RestController
public class HelpController {
    
    @Autowired
    private HelpService helpService;

    /**
     * 帮助保存--修改
     * @param help
     * @return
     */
    @RequestMapping(value = "/help/helpSave", method = RequestMethod.POST)
    public Response helpSave(Help help){
        return helpService.helpSave(help);
    }

    /**
     * 帮助分页
     * @return
     */
    @RequestMapping(value = "/help/helpList", method = RequestMethod.GET)
    public Response helpList(@RequestParam(value = "page") Integer page,
                             @RequestParam(value = "size") Integer size,
                             @RequestParam(value = "draw") String draw,
                             @RequestParam(value = "type", required = false) String type){
        return helpService.helpList(page, size, draw, type);
    }

    /**
     * 更改帮助状态
     * @return
     */
    @RequestMapping(value = "/help/helpChangeStatus", method = RequestMethod.GET)
    public Response helpChangeStatus(String id){
        return helpService.helpChangeStatus(id);
    }

    /**
     * 帮助删除
     * @return
     */
    @RequestMapping(value = "/help/helpDelete", method = RequestMethod.GET)
    public Response helpDelete(String id){
        return helpService.helpDelete(id);
    }

    /**
     * 帮助详情
     * @return
     */
    @RequestMapping(value = "/help/getInfoById", method = RequestMethod.GET)
    public Response getInfoById(String id){
        return helpService.getInfoById(id);
    }

    /**
     * 类别保存--修改
     * @param helpCate
     * @return
     */
    @RequestMapping(value = "/help/helpCateSave", method = RequestMethod.POST)
    public Response helpCateSave(HelpCate helpCate){
        return helpService.helpCateSave(helpCate);
    }

    /**
     * 类别查询
     * @return
     */
    @RequestMapping(value = "/help/helpCateList", method = RequestMethod.GET)
    public Response helpCateList(){
        return helpService.helpCateList();
    }

    /**
     * 更改类别状态
     * @return
     */
    @RequestMapping(value = "/help/helpCateChangeStatus", method = RequestMethod.GET)
    public Response helpCateChangeStatus(String id){
        return helpService.helpCateChangeStatus(id);
    }

    /**
     * 类别删除
     * @return
     */
    @RequestMapping(value = "/help/helpCateDelete", method = RequestMethod.GET)
    public Response helpCateDelete(String id){
        return helpService.helpCateDelete(id);
    }
    
    
}
